package com.yonyou.cyxdms.sysAuth.service.dto.user;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yonyou.cyx.framework.bean.dto.base.BaseDTO;
import com.yonyou.cyx.function.utils.bean.BeanMapperUtil;
import com.yonyou.cyxdms.framework.bean.entity.base.DMSBasePO;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 账号信息
 * </p>
 *
 * @author zhangxianchao
 * @since 2018-09-13
 */
@TableName("tm_user")
public class UserPO extends DMSBasePO<UserPO> {

    private static final long serialVersionUID = 1L;
    /**
     * 账号ID
     */
    @TableId(value = "USER_ID", type = IdType.AUTO)
    private Long userId;
    /**
     * 公司Code
     */
    @TableField("APP_ID")
    private String appId;
    /**
     * 员工ID
     */
    @TableField("EMP_ID")
    private Long empId;
    /**
     * 作为登陆的ID
     */
    @TableField("USER_CODE")
    private String userCode;
    /**
     * 密码
     */
    @TableField("PASSWORD")
    private String password;
    /**
     * 停用，起用(暂时保留)
     */
    @TableField("USER_STATUS")
    private Integer userStatus;
    /**
     * 最后登录时间
     */
    @TableField("LOGIN_LAST_TIME")
    private LocalDateTime loginLastTime;
    /**
     * 停用日期
     */
    @TableField("STOP_DATE")
    private LocalDateTime stopDate;
    /**
     * 来源日期
     */
    @TableField("SOURCE_CHANGED_AT")
    private LocalDateTime sourceChangedAt;

    @TableField("ORG_ID")
    private Long orgId;

    @TableField("USER_TYPE")
    private Integer userType;

    public String getvlogin() {
        return vLogin;
    }

    public void setvlogin(String vLogin) {
        this.vLogin = vLogin;
    }

    private String vLogin;
    @TableField("LOCK_CAUSE")
    private String lockCause;

    public String getLockCause() {
        return lockCause;
    }

    public void setLockCause(String lockCause) {
        this.lockCause = lockCause;
    }

    @Override
    public String toString() {
        return "UserPO{" +
                "userId=" + userId +
                ", appId='" + appId + '\'' +
                ", empId=" + empId +
                ", userCode='" + userCode + '\'' +
                ", password='" + password + '\'' +
                ", userStatus=" + userStatus +
                ", loginLastTime=" + loginLastTime +
                ", stopDate=" + stopDate +
                ", sourceChangedAt=" + sourceChangedAt +
                ", orgId=" + orgId +
                ", userType=" + userType +
                ", VLogin='" + vLogin + '\'' +
                '}';
    }


    public UserPO() {
        super();
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public Long getEmpId() {
        return empId;
    }

    public void setEmpId(Long empId) {
        this.empId = empId;
    }

    public String getUserCode() {
        return userCode;
    }

    public void setUserCode(String userCode) {
        this.userCode = userCode;
    }

    public Integer getUserStatus() {
        return userStatus;
    }

    public void setUserStatus(Integer userStatus) {
        this.userStatus = userStatus;
    }

    public LocalDateTime getLoginLastTime() {
        return loginLastTime;
    }

    public void setLoginLastTime(LocalDateTime loginLastTime) {
        this.loginLastTime = loginLastTime;
    }

    public LocalDateTime getStopDate() {
        return stopDate;
    }

    public void setStopDate(LocalDateTime stopDate) {
        this.stopDate = stopDate;
    }

    public LocalDateTime getSourceChangedAt() {
        return sourceChangedAt;
    }

    public void setSourceChangedAt(LocalDateTime sourceChangedAt) {
        this.sourceChangedAt = sourceChangedAt;
    }

    public Long getOrgId() {
        return orgId;
    }

    public void setOrgId(Long orgId) {
        this.orgId = orgId;
    }

    public Integer getUserType() {
        return userType;
    }

    public void setUserType(Integer userType) {
        this.userType = userType;
    }

    @Override
    protected Serializable pkVal() {
        return this.userId;
    }

    /**
     * 将PO 信息转化为DTO
     *
     * @param dto 需要进行转换的dto
     * @author zhangxianchao
     * @since 2018/7/22 0022
     */
    public <T extends BaseDTO> void transDtoToPo(T dto) {
        BeanMapperUtil.copyProperties(this, dto, "userId");
    }


}
